package com.xyy.saas.payment.constants;


import com.xyy.saas.payment.cores.enums.FbankTradeCodeEnum;

import java.util.*;

/**
 * @author wangzeqi
 */
public class ReconcileTradeConstants {

    public static final String PAY_REPORT_PAYNO_PREFIX = "PINGAN_DAILY_END_AMOUNT";

    public static final List<Integer> popReconcileFundAccountTradeCodes1 = Arrays.asList(
            FbankTradeCodeEnum.FTC_1.getCode(), FbankTradeCodeEnum.FTC_13.getCode(),
            FbankTradeCodeEnum.FTC_12.getCode(), FbankTradeCodeEnum.FTC_14.getCode(),
            FbankTradeCodeEnum.FTC_11.getCode(), FbankTradeCodeEnum.FTC_20.getCode(),FbankTradeCodeEnum.FTC_17.getCode());

    public static final List<Integer> selfSupportReconcileInFundAccountTradeCodes1 = Arrays.asList(
            FbankTradeCodeEnum.FTC_1.getCode(), FbankTradeCodeEnum.FTC_3.getCode(),
            FbankTradeCodeEnum.FTC_4.getCode(), FbankTradeCodeEnum.FTC_9.getCode(), FbankTradeCodeEnum.FTC_7_1.getCode());

    public static final Map<String, String> ecSelfSupportReconcileAccountMap = new HashMap<String, String>() {
        private static final long serialVersionUID = -8544339460332204519L;

        {
            put("1f62", "4294000000010797"); // 武汉小药药
            put("1b81", "4294000000010188"); // 重庆小药药
            put("11a9", "4294000000010787"); // 长沙小药药
            put("13ab", "4294000000008018"); // 山东小药药
            put("11a8", "4294000000010209"); // 杭州小药药
        }
    };

    /**
     * fbank_pay_records -- separate_order
     */
    public static final List<Integer> reconcileSeparateOrderTradeCodes1 = new ArrayList<Integer>() {
        private static final long serialVersionUID = 5731020268136340173L;

        {
            // fbank.business_no = separate_order.separate_no  fbank.trade_code = separate_order.trade_code
            // 直接支付T0
            add(FbankTradeCodeEnum.FTC_1.getCode());
            // 资方交易T0
            add(FbankTradeCodeEnum.FTC_24.getCode());
            // 分账
            add(FbankTradeCodeEnum.FTC_13.getCode());
            // 分账撤销
            add(FbankTradeCodeEnum.FTC_14.getCode());
            // 登记挂账
            add(FbankTradeCodeEnum.FTC_17.getCode());
            // 可提现冻结  (会员冻结 == 可提现冻结)
            add(FbankTradeCodeEnum.FTC_20.getCode());
            // 会员冻结
            add(FbankTradeCodeEnum.FTC_2.getCode());
            // 可提现解冻  (会员解冻 == 可提现解冻)
            add(FbankTradeCodeEnum.FTC_12.getCode());
            // 会员解冻
            add(FbankTradeCodeEnum.FTC_21.getCode());
            // 支付到平台
            add(FbankTradeCodeEnum.FTC_16.getCode());
        }
    };

    /**
     * fbank_pay_records -- separate_order 会员间交易退款 特殊处理
     */
    public static final List<Integer> reconcileSeparateOrderTradeCodes2 = new ArrayList<Integer>() {
        private static final long serialVersionUID = 5731020268136340173L;

        {
            // fbank.business_no = separate_order.separate_no
            // 会员间交易退款（退款垫资回补） fbank.trade_code == 11 and separate_order.trade_code == 1 and separate_order.refund == 1
            // 平安贷退款 fbank.trade_code == separate_order.trade_code == 11
            add(FbankTradeCodeEnum.FTC_11.getCode());

        }
    };


    /**
     * fbank_pay_records -- pay_result_order
     */
    public static final List<Integer> reconcilePayResultOrderOrderTradeCodes = new ArrayList<Integer>() {
        private static final long serialVersionUID = -5141474671688604106L;

        {
            // fbank.business_no = pay_result_order.pay_no
            // 冻结充值
            add(FbankTradeCodeEnum.FTC_10.getCode());
            // 在途充值
            add(FbankTradeCodeEnum.FTC_4.getCode());

            // 见证+收单充值
            add(FbankTradeCodeEnum.FTC_9.getCode());
            // 见证+收单资金冻结
            add(FbankTradeCodeEnum.FTC_8.getCode());
            // 见证+收单资金流水
            add(FbankTradeCodeEnum.FTC_7.getCode());  // 一笔平安贷支付单，fbank_pay_records应该包含两条记录：见证+收单资金流水、见证+收单资金冻结 or 见证+收单充值
        }
    };

    /**
     * 冻结充值、在途充值
     */
    public static final List<String> reconcilePayResultOrderPayChannels1 = new ArrayList<String>() {
        private static final long serialVersionUID = -1769055538145078020L;

        {
            add("jdaggregate_wx");
            add("jd_card");
            add("direct_alipay");
            add("direct_wx");
        }
    };

    public static final List<String> reconcilePinganPayChannels = new ArrayList<String>() {

        private static final long serialVersionUID = -6831407965570386412L;

        {
            add("pingan_alipay");
            add("pingan_aliapy");
            add("pingan_wx");
        }
    };

    public static final String pinganCreditPayChannel = "pingan_credit";

    /**
     * 见证+收单充值、见证+收单资金冻结、见证+收单资金流水
     */
    public static final List<String> reconcilePayResultOrderPayChannels2 = new ArrayList<String>() {
        private static final long serialVersionUID = -6831407965570386412L;

        {
            add("pingan_alipay");
            add("pingan_aliapy");
            add("pingan_wx");
            add("pingan_credit");
        }
    };

    /**
     * fbank_pay_records -- refund_order
     */
    public static final List<Integer> reconcileRefundOrderOrderTradeCodes = new ArrayList<Integer>() {
        private static final long serialVersionUID = -5141474671688604106L;

        {
            // fbank.business_no = refund_order.pay_no
            // 冻结充值撤销
            add(FbankTradeCodeEnum.FTC_5.getCode());
            // 在途充值撤销
            add(FbankTradeCodeEnum.FTC_3.getCode());

            // fbank.business_no = refund_order.refund_no
            // 见证+收单退款  平安支付渠道退款
            add(FbankTradeCodeEnum.FTC_6.getCode());

            // 见证+收单资金流水（退款） 平安贷退款
            add(FbankTradeCodeEnum.FTC_7_1.getCode());

        }
    };

    /**
     * fbank_pay_records -- withdraw_order
     */
    public static final List<Integer> reconcileWithDrawOrderTradeCodes = new ArrayList<Integer>() {
        private static final long serialVersionUID = 5731020268136340173L;

        {
            // fbank.business_no = withdraw_order.withdraw_no
            add(FbankTradeCodeEnum.FTC_15.getCode());
        }
    };

}
